<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        i{
            background-color: chocolate;
            position: absolute;
            cursor: pointer;
            /* 将鼠标指针变成手形 */
        }
        img{
            margin-left:15px;
        }
    </style>
</head>
<body>
    <i>✖️</i>
    <img src="/Users/D盘/JavaScript练习/picture/淘宝二维码.webp" alt="">
    
</body>
<script>
    var img = document.querySelector('img');
    var i = document.querySelector('i');
    i.onclick = function(){
        img.style.display = 'none';
        this.style.display = 'none';
        
    }
</script>
</html>